package com.example.siyun.service.impl.carouselserviceimpl;


import com.example.siyun.mapper.carouselmapper.CarouselMapper;
import com.example.siyun.pojo.Carousel;
import com.example.siyun.service.carouselservice.CarouselService;
import com.example.siyun.util.SensitiveFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author XZZ
 * @Date 2022/9/14 10：50（加注解时间）
 * @Decription :广告轮播图的service实体类
 */
@Service
public class CarouselServiceImpl implements CarouselService {
    @Autowired
    private CarouselMapper carouselMapper;
    @Autowired
    private SensitiveFilter sen;
    /**
     *全查
     * @return
     */
    @Override
    @Transactional
    public List<Carousel> getAll() {

        return carouselMapper.getAll();
    }

    /**
     * 数据删除
     * @param number
     */
    @Override
    @Transactional
    public void del(Integer number) {
        carouselMapper.del(number);
    }

    /**
     * 数据修改
     * @param carousel
     */
    @Override
    @Transactional
    public void update(Carousel carousel) {
        carouselMapper.update(carousel);
    }

    /**
     * 模糊查询
     * @param imageType
     * @param isOnline
     * @return
     */
    @Override
    @Transactional
    public List<Carousel> getCaByTitle(String imageType, String isOnline) {
        List<Carousel> caByTitle = carouselMapper.getCaByTitle(imageType, isOnline);
        return caByTitle;
    }

    /**
     * 添加数据
     * @param carousel
     */
    @Override
    @Transactional
    public void insert(Carousel carousel) {
        String filter = sen.filter(carousel.getImageTitle());
        carousel.setImageTitle(filter);
        carouselMapper.insert(carousel);

    }



}
